var obj = {
    name:'feng',
    age:19,
    dog:{name:'123',age:'19'},
    car:['五菱宏光','摩托车']
}
var obj2 = {}
function extend(obj,obj2) {
    for(item in obj){
        if(obj[item] instanceof Array){
            obj2[item] = []
            extend(obj[item],obj2[item])
        }else if (obj[item] instanceof Object){
            obj2[item] = {}
            extend(obj[item],obj2[item])
        }else{
            obj2[item] = obj[item]
        }
        
    }
}
extend(obj,obj2)
console.log(obj2);

// console.dir(obj2)